package com.xing.binbackend.http;

import lombok.Data;

@Data
public class RestfulResponse<T> {
    private int status;
    private String message;
    private T data;

    public RestfulResponse(int status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public static <T> RestfulResponse<T> success(T data) {
        return new RestfulResponse<>(200, "Success", data);
    }

    public static <T> RestfulResponse<T> error(int status, String message) {
        return new RestfulResponse<>(status, message, null);
    }
}
